'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    await ctx.render('pages/index/index');
  }

  async u8jvZTpVbo() {
    const { ctx } = this;
    await ctx.render('pages/index/u8jvZTpVbo');
  }

  
  async posterWxView() {
    const { ctx } = this;
    const topicId = ctx.params.topicId;
    const [ topic ] = await ctx.service.cms.getTopicDetail({
      id: topicId,
    });
    await ctx.render('weixin/poster', {
      topic: topic,
    });
  }

  async orderList() {
    const { ctx } = this;
    await ctx.render('pages/order/list', {
      menuKey: 'wpn-order-list'
    });
  }
  
  async dashboard() {
    const { ctx } = this;
    await ctx.render('pages/dashboard/index', {
      menuKey: 'wpn-dashboard'
    });
  }

  async user() {
    const { ctx } = this;
    await ctx.render('pages/user/index');
  }

  async login() {
    const { ctx } = this;
    await ctx.render('pages/login/login');
  }

  async subOrder() {
    const { ctx } = this;
    await ctx.render('pages/suborder/index', {
      subMenuKey: 'wpn-sub-order-list'
    });
  }

  async specialist() {
    const { ctx } = this;
    await ctx.render('pages/specialist/index', {
      menuKey: 'wpn-specialist-list'
    });
  }

  async customerList() {
    const { ctx } = this;
    await ctx.render('pages/customer/index', {
      menuKey: 'wpn-customer-list'
    });
  }
}

module.exports = HomeController;
